import { IsNumber, IsString, MaxLength, MinLength } from 'class-validator'
import { Menu } from 'src/auth/menu/entities/menu.entity'

export class CreateRoleDto {
  @IsString()
  @MinLength(2)
  @MaxLength(24)
  name: string

  @IsString()
  @MinLength(2)
  @MaxLength(24)
  code: string

  @IsString()
  description?: string
}

class Tree extends Menu {
  operations: string[]
}

export class BindRoleMenuDto {
  roleId: number
  tree: Tree[]
}

export class BindRoleDto {
  @IsNumber()
  userId: number

  @IsNumber()
  roleId: number
}
